<template>
    <div class="Msg-Detail-Main">
        <van-nav-bar left-arrow @click-left="onClickLeft">
            <template #left>
                <van-icon :name="backicon" size="20"/>
            </template>
            <template #title>
                <span class="hometitle">消息详情</span>
            </template>
        </van-nav-bar>

        <div class="List-main">
            <div class="Message-template">
                <p>{{Message.content}}</p>
                <span>{{Message.send_time | formateDate}}</span>
            </div>
        </div>
    </div>
</template>
<script>
import {_getMessageInfo} from '../../service/user'
export default {
    data(){
        return{
            backicon:require('../../assets/img/backicon.png'),
            Message:{}
        }
    },
    mounted(){
        let id=this.$route.query.id
        // console.log(id)
        this.getData(Number(id))
    },
    filters:{
        formateDate(time){
            return moment(time*1000).format('YYYY-MM-DD HH:mm:ss')
        }
    },
    methods:{
        onClickLeft(){
            this.$router.push("/MsgList")
        },
        getData(id){
            let _this=this
            let uid=JSON.parse(localStorage.getItem("user")).user_id
            _getMessageInfo({
                user_id:uid,
                message_id:id
            }).then(res=>{
                console.log(res)
                if(res.errcode==1){
                    _this.Message=res.data
                }
            })
        }
    }
}
</script>
<style lang="less" scoped>
.font-SC(){
    font-family: "PingFang SC","Microsoft YaHei";
}
.Msg-Detail-Main{
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    .hometitle{
        font-size: 18px;
        .font-SC();
        font-weight: bold;
        color: #000;
        line-height: 46px;
    }

    .List-main{
        width: 100%;
        .Message-template{
            width: 345px;
            height: auto;
            margin: 9px auto 0 auto;
            background-color: #fff;
            border-radius: 5px;
            padding: 10px;
            box-shadow: 3px 3px 20px rgba(153, 153, 153, .35);
            // position: absolute;
            img{
                width: 11px;
                float: right;
            }
            p{
                .font-SC();
                font-size: 15px;
                color: #000;
                margin-bottom: 0;
                line-height: 24px;
            }
            span{
                margin-top: 30px;
                display: block;
                width: 100%;
                text-align: right;
                font-family: "DINPro Medium";
                font-size: 12px;
                color: #999;
                
            }
        }
    }
}
</style>